
<div style="clear: both;">
    <?php echo CHtml::beginForm('', 'post', array('class' => 'dot_form fw_50')); ?>
    <fieldset>
        <legend><?php echo Yii::t('common', 'please_fill_table_contents'); ?></legend>
        <dl>
            <dt><?php echo CHtml::activeLabelEx($model, 'type'); ?></dt>
            <dd>
                <?php
                echo CHtml::activeDropDownList($model, 'type', Node::model()->validateTypeOptions);
                ?>
            </dd>
            
            <dt><?php echo CHtml::activeLabelEx($model, 'parent_id'); ?></dt>
            <dd>
                <div>
                <?php
                require_once(Yii::app()->basePath . '/extensions/YHelper/YTreeFormat.php');
                $datas = Node::model()->getCTreeViewDatas();
                if (count($datas)) {
                    $datas = dumpArrayTree($datas);
                }
                $trees = array('1' => 'ΞΞ NODE ROOT ΞΞ');
                if (count($datas)) {
                    foreach ($datas as $data) {
                        $trees[$data['id']] = $data['levelstr'] . '⇒ ' . strip_tags($data['text']) . '《' . (string)$data['order_pos'] . '》';
                    }
                }
                echo CHtml::activeDropDownList($model, 'parent_id', $trees);
                ?>
                </div>
                <div><?php echo CHtml::error($model, 'parent_id'); ?></div>
            </dd>

            <dt><?php echo CHtml::activeLabelEx($model, 'name'); ?></dt>
            <dd>
                <div>
                    <?php
                    echo CHtml::activeTextField($model, 'name', array(
                        'maxlength' => 200,
                        'class' => 'large'
                    ));
                    ?>
                    <span style="padding-left: 12px;"><?php echo Yii::t('node', 'hint_name'); ?></span>
                </div>
                <div><?php echo CHtml::error($model, 'name'); ?></div>
            </dd>
            
            <dt><?php echo CHtml::activeLabelEx($model, 'order_pos'); ?></dt>
            <dd>
                <div><?php echo CHtml::activeDropDownList($model, 'order_pos', Node::model()->orderPosOptions); ?></div>
            </dd>

            <dt><?php echo CHtml::activeLabelEx($model, 'show_in_menus'); ?></dt>
            <dd>
                <div>
                    <?php echo CHtml::activeCheckBox($model, 'show_in_menus'); ?>
                </div>
                <div><?php echo CHtml::error($model, 'show_in_menus'); ?></div>
            </dd>
            
            <dt><?php echo CHtml::activeLabelEx($model, 'open_target'); ?></dt>
            <dd>
                <div>
                    <?php echo CHtml::activeDropDownList($model, 'open_target', Node::model()->openTargetOptions);  ?>
                </div>
                <div><?php echo CHtml::error($model, 'open_target'); ?></div>
            </dd>

            <dt><?php echo CHtml::activeLabelEx($model, 'url_args_frontend'); ?></dt>
            <dd>
                <div>
                    <?php
                    echo CHtml::activeTextField($model, 'url_args_frontend', array(
                        'maxlength' => 100,
                        'class' => 'large'
                    ));
                    ?>
                </div>
                <div><?php echo CHtml::error($model, 'url_args_frontend'); ?></div>
            </dd>
            
            <dt>&nbsp;</dt>
            <dd>
                <?php
                echo CHtml::activeHiddenField($model, 'id');
                echo CHtml::submitButton($model->isNewRecord
                    ? Yii::t('common', 'save') : Yii::t('common', 'update'), array(
                    'class' => 'btn'
                ));
                ?>
            </dd>
        </dl>
    </fieldset>
    <?php echo CHtml::endForm(); ?>
</div>
<?php if (!$model->isNewRecord): ?>
<fieldset>
    <legend><?php echo Yii::t('node', 'hint_delete_node'); ?></legend>

    <div>
    <?php
    echo CHtml::beginForm(array('nodes/delete', 'id' => $model->id), 'post', array(
        'class' => 'dot_form fw_50',
        'onsubmit' => "return confirm('" . Yii::t('node', 'delete_node_confirm_message', array('node_name' => $model->name)) . "');",
    ));
    ?>
    </div>
    <div>
    <?php
    echo CHtml::radioButtonList('delete_range', 0, array(
        Yii::t('node', 'delete_node_only_self', array('node_name' => $model->name)),
        Yii::t('node', 'delete_node_with_all_subs', array('node_name' => $model->name))
    ));
    ?>
    </div>
    <div>
    <?php echo CHtml::submitButton(Yii::t('common', 'delete'), array('class' => 'btn')); ?>
    <?php echo CHtml::endForm(); ?>
    </div>
</fieldset>
<?php endif; ?>